package com.task.src.controller;

import com.task.src.eum.Status;
import com.task.src.service.EmailService;
import com.task.src.util.ResponseResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/email")
public class EmailController {

    @Resource
    private EmailService emailService;

    @RequestMapping("/sendEmail")
    public ResponseResult sendEmail(String e){
        ResponseResult res=new ResponseResult();
        boolean r=emailService.sendHtmlEmail(e);
        if(r){
            res.setCode(200);
            res.setMessage(Status.EMAIL_SUCCESS);
            return res;
        }
        res.setCode(500);
        res.setMessage(Status.EMAIL_FAIL);
        return res;
    }
}
